//
//  ZDTabBarController.m
//  1012GiftTips
//
//  Created by Apple on 15/10/12.
//  Copyright © 2015年 itcast. All rights reserved.
//

#import "ZDTabBarController.h"
#import "ZDTabBar.h"

typedef enum
{
    ZDGenderBoy,
    ZDGenderGirl
} ZDGender;

@interface ZDTabBarController ()

@end

@implementation ZDTabBarController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    //创建自定义tabBar
    ZDTabBar *tabBar = [[ZDTabBar alloc] init];
    
    //设置frame
    tabBar.frame = self.tabBar.bounds;
    
    tabBar.backgroundColor = [UIColor whiteColor];
    
    //添加到系统自带tabBar上
    [self.tabBar addSubview:tabBar];
    
    
    NSArray *titleArray = @[@"礼物说", @"热门", @"分类", @"我"];
    
    //创建tabBar中的按钮 个数由tabBarController的子控制器个数决定
    [tabBar addTabBarButtonWithNormalName:@"TabBar_home" andSelectedName:@"TabBar_home_selected" andTitle:titleArray[0]];
    [tabBar addTabBarButtonWithNormalName:@"TabBar_gift" andSelectedName:@"TabBar_gift_selected" andTitle:titleArray[1]];
    [tabBar addTabBarButtonWithNormalName:@"TabBar_category" andSelectedName:@"TabBar_category_Selected" andTitle:titleArray[2]];
    
    if (/* DISABLES CODE */ (0) == ZDGenderBoy)
    {
        [tabBar addTabBarButtonWithNormalName:@"TabBar_me_boy" andSelectedName:@"TabBar_me_boy_selected" andTitle:titleArray[3]];
    }
    else
    {
        [tabBar addTabBarButtonWithNormalName:@"TabBar_me_girl" andSelectedName:@"TabBar_me_girl_selected" andTitle:titleArray[3]];
    }
    
    //点击tabBar按钮切换控制器
    tabBar.block = ^(NSInteger index){
        
        self.selectedIndex = index;
    };

}


- (void)setSelectedViewController:(__kindof UIViewController *)selectedViewController
{
    [super setSelectedViewController:selectedViewController];
}



@end
